package cn.edu.zsc.rbac.domain.vo;


import cn.edu.zsc.rbac.domain.util.DateTimeUtils;

import java.time.LocalDateTime;

public class UserVo extends BaseVo {

    /**
     * 用户名，用来登录的
     */
    public String username;

    /**
     * 真实姓名
     */
    public String name;

    /**
     * 电话
     */
    public String mobile;

    /**
     * 邮箱
     */
    public String email;

    /**
     * 所属的部门ID
     */
    public Integer deptId;

    /**
     * 所属的部门名称
     */
    public String deptName;

    /**
     * 具有的角色ID
     */
    public Integer roleId;


    /**
     * 具有的角色名称
     */
    public String roleName;

    /**
     * 状态：启用|停用
     */
    public boolean enabled = true;

    public UserVo() {
    }

    public UserVo(Integer id, LocalDateTime createAt, LocalDateTime updateAt, String username, String name,
                  String mobile, String email, Integer deptId, String deptName, Integer roleId, String roleName, boolean enabled) {
        super(id, createAt, updateAt);
        this.username = username;
        this.name = name;
        this.mobile = mobile;
        this.email = email;
        this.deptId = deptId;
        this.deptName = deptName;
        this.roleId = roleId;
        this.roleName = roleName;
        this.enabled = enabled;
    }

    @Override
    public String toString() {
        return String.format("ID：%d，用户名：%s，姓名：%s，手机：%s，邮箱：%s，部门名称：%s，角色名称：%S，状态：%s，更新时间：%s",
                id, username, name, mobile, email, deptName, roleName, enabled ? "启用" : "停用", DateTimeUtils.format(updateAt));
    }
}
